#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 4e4 + 5;

ll n;
vector<ll> get_p(ll n) {
  vector<ll> ans;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i) continue;
    ans.push_back(i);
    while (n % i == 0) n /= i;
  }
  if (n > 1) ans.push_back(n);
  return ans;
}
ll phi(ll x, vector<ll>& primes) {
  ll ans = x;
  for (ll p : primes) {
    if (x % p == 0) ans = ans / p * (p - 1);
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  vector<ll> primes = get_p(n);
  set<pll> ans;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i) continue;
    ll j = n / i;
    ans.insert(pll(i, phi(j, primes)));
    if (j != i) ans.insert(pll(j, phi(i, primes)));
  }
  for (pll now : ans) cout << now.first << ' ' << now.second << endl;
  return 0;
}